package task13;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 东莞呵呵
 * Date:2022-09-26
 * Time:21:23
 */

import java.util.Scanner;

// 注意类名必须为 Main, 不要有任何 package xxx 信息
public class Demo1 {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        // 注意 hasNext 和 hasNextLine 的区别
        while (in.hasNextInt()) { // 注意 while 处理多个 case
            int year = in.nextInt();
            int mount = in.nextInt();
            int day = in.nextInt();
            int feb = 28;

            if (year % 4 == 0 && year % 100 != 0 || year % 400 == 0) {
                feb = 29;
            }
            switch (mount - 1) {
                case 12:
                    day += 31;
                case 11:
                    day += 30;
                case 10:
                    day += 31;
                case 9:
                    day += 30;
                case 8:
                    day += 31;
                case 7:
                    day += 31;
                case 6:
                    day += 30;
                case 5:
                    day += 31;
                case 4:
                    day += 30;
                case 3:
                    day += 31;
                case 2:
                    day += feb;
                case 1:
                    day += 31;
            }
            System.out.println(day);
        }
    }
}
